package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.util.GetMoneyLvUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 本行确认转账信息
 */
public class SureBankTrPp extends BasePopupView {
    @BindView(R.id.sure_deal_info_title)
    TextView sureDealInfoTitle;
    @BindView(R.id.sure_deal_info_numtext)
    TextView sureDealInfoNumtext;
    @BindView(R.id.sure_deal_username)
    TextView sureDealUsername;
    @BindView(R.id.sure_deal_info_moneytext)
    TextView sureDealInfoMoneytext;
    @BindView(R.id.sure_deal_info_nobtn)
    Button sureDealInfoNobtn;
    @BindView(R.id.sure_deal_info_okbtn)
    Button sureDealInfoOkbtn;
    Unbinder bind;
    SureBankTrPpCallBack mSureBankTrPpCallBack;
    String type;
    String username;
    String cardnum;
    String money;

    public SureBankTrPp(@NonNull Context context, SureBankTrPpCallBack sureBankTrPpCallBack) {
        super(context);
        mSureBankTrPpCallBack = sureBankTrPpCallBack;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getCardnum() {
        return cardnum;
    }

    public void setCardnum(String cardnum) {
        this.cardnum = cardnum;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.sure_bank_tr_pp_layout;
    }


    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);

        sureDealInfoTitle.setText(type);
        sureDealInfoNumtext.setText(cardnum);
        sureDealUsername.setText(username);
        sureDealInfoMoneytext.setText(GetMoneyLvUtils.getInputMoney(money));
    }

    @OnClick({R.id.sure_deal_info_nobtn, R.id.sure_deal_info_okbtn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.sure_deal_info_nobtn:
                mSureBankTrPpCallBack.lastStep();
                break;
            case R.id.sure_deal_info_okbtn:
                mSureBankTrPpCallBack.next();
                break;
        }
    }

    public interface SureBankTrPpCallBack {
        void lastStep();

        void next();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }


}
